Page({
  data: {
    list: [
      {
        id: 'commodity',
        name: '商品管理',
        open: false,
        pages: [{
          name: 'addcommodity', pname: '添加商品'
        }, { name: 'commoditymanagement', pname: '管理商品' }]
      },
      {
        id: 'buyer',
        name: '买家管理',
        open: false,
        pages: [{ name: 'addbuyer', pname: '添加买家' }, { name: 'buyermanagement', pname:'管理买家'}]
      }
    ],

    init: [
      {
        id: 'management',
        name: '期初与期末',
        open: false,
        pages: [{
          name: 'initialize', mname: '初始化'
        }, { name: 'archive', mname: '归档' }]
      
      }]
  },


  kindToggle: function (e) {
    var id = e.currentTarget.id, list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    });
  },

  kindToggle2: function (e) {
    var id = e.currentTarget.id, init = this.data.init;
    for (var i = 0, len = init.length; i < len; ++i) {
      if (init[i].id == id) {
        init[i].open = !init[i].open
      } else {
        init[i].open = false
      }
    }
    this.setData({
      init: init
    });
  },

  later :function(){
    wx.showToast({
      title: '功能尚未推出',
      icon:'none'
    })
  }






});


